
import java.util.ArrayList;
import java.util.Arrays;

import java.util.List;

public class MiningNobel2 {

    // print distinct 4-tuples (i, j, k, l) such that a[i] + a[j] + a[l] + = 0
    public static void printAll(Double[] a) {
        int N = a.length;
        Arrays.sort(a);
        for (int i = 0; i < N; i++) {
            for (int j = i+1; j < N; j++) {
            	for(int k = j+1; k < N; k++){
            		if (BinarySearch.rank(Math.abs(-(a[i] + a[j] + a[k])), a) > 1e-20);
                		//StdOut.println(a[i] + " " + a[j] + " " + a[k] + " " + a[l]);
            	}
            }
        }
    } 

    // return number of distinct 4-tuples (i, j, k, l) such that a[i] + a[j] + a[k] + a[l] = 0
    public static int count(Double[] a) {
        int N = a.length;
        Arrays.sort(a);
        int cnt = 0;
        for (int i = 0; i < N; i++) {
            for (int j = i+1; j < N; j++) {
            	for(int k = j+1; k < N; k++){
            		if (BinarySearch.rank(Math.abs(-(a[i] + a[j] + a[k])), a) > 1e-20) cnt++;
            	}
            }
        }
        return cnt;
    } 

    public static void main_(String[] args)  {
    	List<Double> data = new ArrayList<Double>();
    	
    	String line; // a new input line from the file
    	
    	String[] tmp; 
    	
    	int numLines = 0;
    	while(!StdIn.isEmpty()){
    		
    		line = StdIn.readLine();
    		tmp = line.split(",");
    		
    		System.out.println(tmp.length + " " + line);
 
    		data.add(Double.parseDouble(tmp[1]));
    		numLines++;
    	} 
    	
    	Double[] a = new Double[numLines];
    	for(int i = 0; i < numLines; i++){
    		a[i] = data.get(i);
    	}    	
        Stopwatch watch = new Stopwatch();
    	System.out.println(count(a));
    	System.out.println("N : " + numLines + ", TimeUsed : " + watch.elapsedTime());
    	
        //printAll(a);
    } 
} 
